a = input()
b = True
c = ['(]' , '(}', '(>', '[)', '[}', '[>', '{)', '{]', '{>', '<)', '<]', '<}']
d = '(){}<>[]'
e = ''
for i in range(len(a)):
    if (a[i] in d):
        e += a[i]
for i in range(len(c)):
    if c[i] in e:
        b = False
        break
print(b)
    
    
